/**
 * 机构api
 */

export const DEPT_API_PRE_SUFFER = '/dept/'
import { Dept } from '@/entity/system/dept'
import { PostRequestApi, PutRequestApi } from '@/utils/api/RequestApi'

/**
 * 查询机构下拉框
 */
export function deptSelected() {
  return new PostRequestApi<Array<Dept>>(DEPT_API_PRE_SUFFER + 'selected').get()
}

/**
 * 查询机构树
 */
export function deptTree() {
  return new PostRequestApi<Dept>(DEPT_API_PRE_SUFFER + 'tree').get()
}

/**
 * 新增机构
 */
export function add(data: Dept) {
  return new PostRequestApi<Dept>(DEPT_API_PRE_SUFFER, data).get()
}

/**
 * 修改机构
 */
export function update(data: Dept) {
  return new PutRequestApi<Dept>(DEPT_API_PRE_SUFFER, data)
}
